broadway: Keep popups above their parent
authorAlexander Larsson <alexl@redhat.com>
Fri, 13 Mar 2020 13:35:43 +0000 (14:35 +0100)
committerAlexander Larsson <alexl@redhat.com>
Fri, 13 Mar 2020 14:06:02 +0000 (15:06 +0100)
We set the parent as a "transient parent" for popups, which means
they will not be stacked below the parent.

gdk/broadway/gdksurface-broadway.c

index bb3acf2f985d3e88ed2d648d0c5247a8831b89ad..9dcf3f14f1c1ed288998c2e11fdab07acdee3572 100644 (file)
@@ -273,6 +273,13 @@ _gdk_broadway_display_create_surface (GdkDisplay     *display,
 
   connect_frame_clock (surface);
 
+  /* We treat the real parent as a default transient for to get stacking right */
+  if (parent)
+    {
+      impl->transient_for = GDK_BROADWAY_SURFACE (parent)->id;
+      _gdk_broadway_server_surface_set_transient_for (broadway_display->server, impl->id, impl->transient_for);
+    }
+
   return surface;
 }
 
@@ -670,6 +677,10 @@ gdk_broadway_surface_set_transient_for (GdkSurface *surface,
 
   impl = GDK_BROADWAY_SURFACE (surface);
 
+  /* We treat the real parent as a default transient for to get stacking right */
+  if (parent == NULL)
+    parent = surface->parent;
+
   parent_id = 0;
   if (parent)
     parent_id = GDK_BROADWAY_SURFACE (parent)->id;